<template>
	<el-select :value="value" placeholder="请选择" @input="renewVersion">
		<el-option v-for="(ver, index) in versions" :key="index" :label="ver.name" :value="ver.id">
		</el-option>
	</el-select>
</template>

<script>
	export default {
		name: "versionSelect",
		props: ['value'],
		emits: ['input', "change"],
		data() {
			return {
				versions: [],
			}
		},
		methods: {
			renewVersion(version) {
				this.$emit("input", version);
				this.$emit("change", version);
			},
		},
		mounted() {
			this.$api.get('/version/list').then((res) => {
				this.versions = res.data.versions;
			});
		}
	}
</script>

<style>
</style>